import React, { Component } from "react";
import { NavLink } from "react-router-dom";
import MyNavlinkStyle from "./MyNavlink.module.css";

export default class MyNavlink extends Component {
  render() {
    // console.log(this.props);
    // children组件内容会直接显示在标签体中,等于以下写法
    // <NavLink activeClassName="mylink" className="link" {...this.props} >{this.props.children}</NavLink>

    return (
      <NavLink
        activeClassName={MyNavlinkStyle.mylink}
        className={MyNavlinkStyle.link}
        {...this.props}
      />
    );
  }
}
